// ***************     LM75 module by Berty    ***************

#include "iic.h"
#include "lm75.h"


signed char read_temperature(void)
 {
 signed char Tmpl,Tmph,Err;
	
	I2C_Start();
    Write_I2C_Byte(LM75_DEV1_READ);
    Err=I2C_Ack();  		// Check for acknowledge from I2C device
    Tmph=Read_I2C_Byte();
    I2C_Rack();
    Tmpl=Read_I2C_Byte();
    I2C_Clock();				  // Clock I2C bit *** No ACK *** //
    I2C_Stop();	  					   // Set I2C Stop condition
    if (Err==1) {return 0xFF;} else {return Tmph;};		
}




/*
void main(void)
{
   unsigned char temperature_t;
     DDRD = 0xFF;	// output
 while (1)
		{
		
		temperature_t=read_temperature();
			PORTD=~temperature_t;					  
  haltb();
  haltb();
  haltb();
  haltb();
  haltb();
  haltb();
	}

} */
